package com.sx.zongzhi.presenter;

import com.sx.zongzhi.MyApplication;
import com.sx.zongzhi.bean.ServicerBean;
import com.sx.zongzhi.modle.ApiManager;
import com.sx.zongzhi.net.BaseCallBack;
import com.sx.zongzhi.net.BaseResult;
import com.sx.zongzhi.view.IServicerView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by XZY on 2017/11/30.
 *获取服务人员
 */
public class ServicerPest {

    private IServicerView servicerView;

    public ServicerPest(IServicerView servicerView) {
        this.servicerView=servicerView;
    }

    /**
     *
     * @param nameKey 姓名或团队搜索
     */
    public void getServicerList(String nameKey){
        Map<String,Object> map=new HashMap<>();
        map.put("sid", MyApplication.sid);
        map.put("serviceTeamMemberVo.nameKey", nameKey);
        new ApiManager().getServicerList(map, new BaseCallBack<BaseResult<ServicerBean>>() {
            @Override
            public void onSuccess(BaseResult<ServicerBean> response) {
                servicerView.getServicerList(response.getData());
            }
            @Override
            public void onFailures(String message) {
                servicerView.showError(message);
            }
        });
    }

}
